package com.ctrlcar.giftrecord.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

/**
 * 该类映射到数据库中的 send_gift 表，用于记录送礼信息。
 *
 * @TableName send_gift
 */
@TableName(value ="send_gift")
@Data
public class SendGift implements Serializable {
    /**
     * 礼物发送记录的唯一标识符。
     */
    @TableId(type = IdType.AUTO)
    private Integer sendId;

    /**
     * 发送礼物的用户ID。
     */
    private Integer userId;

    /**
     * 亲朋ID。
     */
    private Integer relativeId;

    /**
     * 礼物名称。
     */
    private String giftName;

    /**
     * 礼物金额（如果适用）。
     */
    private BigDecimal giftMoney;

    /**
     * 事务。
     */
    private String sendThing;

    /**
     * 礼物发送的时间。
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date sendTime;

    /**
     * 礼物发送的地址。
     */
    private String address;

    /**
     * 关于礼物发送的备注信息。
     */
    private String remark;

    /**
     * 记录创建的时间。
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createTime;

    /**
     * 记录最后更新的时间。
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date updateTime;

    /**
     * 标记记录是否已被逻辑删除。
     */
    private Integer isDelete;


    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        // 判断两个对象是否相等，通过比较所有字段值来实现。
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SendGift other = (SendGift) that;
        return (this.getSendId() == null ? other.getSendId() == null : this.getSendId().equals(other.getSendId()))
                && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
                && (this.getRelativeId() == null ? other.getRelativeId() == null : this.getRelativeId().equals(other.getRelativeId()))
                && (this.getGiftName() == null ? other.getGiftName() == null : this.getGiftName().equals(other.getGiftName()))
                && (this.getGiftMoney() == null ? other.getGiftMoney() == null : this.getGiftMoney().equals(other.getGiftMoney()))
                && (this.getSendThing() == null ? other.getSendThing() == null : this.getSendThing().equals(other.getSendThing()))
                && (this.getSendTime() == null ? other.getSendTime() == null : this.getSendTime().equals(other.getSendTime()))
                && (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress()))
                && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
                && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
                && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
                && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
    }

    @Override
    public int hashCode() {
        // 计算对象的哈希码，基于所有字段值生成。
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getSendId() == null) ? 0 : getSendId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getRelativeId() == null) ? 0 : getRelativeId().hashCode());
        result = prime * result + ((getGiftName() == null) ? 0 : getGiftName().hashCode());
        result = prime * result + ((getGiftMoney() == null) ? 0 : getGiftMoney().hashCode());
        result = prime * result + ((getSendThing() == null) ? 0 : getSendThing().hashCode());
        result = prime * result + ((getSendTime() == null) ? 0 : getSendTime().hashCode());
        result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
        return result;
    }

    @Override
    public String toString() {
        // 将对象转换为字符串表示形式，包含所有字段值。
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", sendId=").append(sendId);
        sb.append(", userId=").append(userId);
        sb.append(", relativeId=").append(relativeId);
        sb.append(", giftName=").append(giftName);
        sb.append(", giftMoney=").append(giftMoney);
        sb.append(", sendThing=").append(sendThing);
        sb.append(", sendTime=").append(sendTime);
        sb.append(", address=").append(address);
        sb.append(", remark=").append(remark);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", isDelete=").append(isDelete);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
